﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MangaRipper.Core
{
    public static class TitleFactory
    {
        /// <summary>
        /// Create Title object base on uri
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        public static ITitle CreateTitle(Uri uri)
        {
            ITitle title = null;
            switch (uri.Host)
            {
                case "mangafox.me":
                case "www.mangafox.me":
                    title = new TitleMangaFox(uri);
                    break;
                case "read.mangashare.com":
                    title = new TitleMangaShare(uri);
                    break;
                 case "mangahere.co":
                 case "www.mangahere.co":
                    title = new TitleMangaHere(uri);
                    break;
                case "mangareader.net":
                case "www.mangareader.net":
                    title = new TitleMangaReader(uri);
                    break;
                case "mangapark.com":
                case "www.mangapark.com":
                    title = new TitleMangaPark(uri);
                    break;
                case "mangaeden.com":
                case "www.mangaeden.com":
                    title = new TitleMangaEden(uri);
                    break;
                case "mangainn.com":
                case "www.mangainn.com":
                    title = new TitleMangaInn(uri);
                    break;
                case "starkana.com":
                case "www.starkana.com":
                    title = new TitleStarkana(uri);
                    break;
                case "mangago.com":
                case "www.mangago.com":
                    title = new TitleMangaGo(uri);
                    break;
                default:
                    string message = String.Format("This site ({0}) is not supported.", uri.Host);
                    throw new Exception(message);
            }
            return title;
        }

        /// <summary>
        /// Get list of supported manga sites
        /// </summary>
        /// <returns></returns>
        public static List<string[]> GetSupportedSites()
        {
            var lst = new List<string[]>();
            lst.Add(new string[] { "MangaFox", "http://mangafox.me/", "English" });
            lst.Add(new string[] { "MangaHere", "http://www.mangahere.co/", "English" });
            lst.Add(new string[] { "MangaReader", "http://www.mangareader.net/", "English" });
            lst.Add(new string[] { "MangaShare", "http://read.mangashare.com/", "English" });
            lst.Add(new string[] { "MangaPark", "http://www.mangapark.com/", "English" });
            lst.Add(new string[] { "MangaEden", "http://www.mangaeden.com/", "English" });
            lst.Add(new string[] { "MangaInn", "http://www.mangainn.com/", "English" });
            lst.Add(new string[] { "Starkana", "http://starkana.com/", "English" });
            lst.Add(new string[] { "MangaGo", "http://mangago.com/", "English" });
            return lst;
        }
    }
}
